#include <iostream>
#include <queue>
#include <algorithm>
#include <vector>

using namespace std;

int main()
{
    int n, k;
    cin >> n >> k;
    priority_queue<int, vector<int>, greater<int>> q;

    for (int i = 0; i < n; i++)
    {
        int tmp;
        cin >> tmp;
        q.push(tmp);
    }

    int i = 0;
    int ans = 0;
    while (i + q.top() <= k)
    {
        ans++;
        int tmp = q.top();

        q.pop();
        i += tmp;
        tmp *= 2;
        q.push(tmp);
    }


    cout << ans << endl;

    return 0;
}